/**
 * 数据验证工具模块
 * @description 导出所有数据验证相关的工具函数、类和规则
 */

// 导出验证器类和函数
export { DataValidator } from './validators';
export {
  validateStudentData,
  validateCourseData,
  validateScheduleTemplateData,
  validateScheduleInstanceData,
  validateRequired,
  validateEmail,
  validatePhone
} from './validators';

// 导出验证规则和常量
export {
  FIELD_LENGTH_RULES,
  NUMBER_RANGE_RULES,
  REGEX_RULES,
  BUSINESS_RULES,
  ERROR_MESSAGES,
  WARNING_MESSAGES,
  VALIDATION_RULE_SETS,
  getFieldLengthRule,
  getNumberRangeRule,
  getRegexRule,
  getBusinessRule,
  matchesPattern,
  isInRange
} from './rules';

// 导出类型定义
export type {
  IValidationResult,
  IFieldValidationResult
} from './validators';

// 导出验证规则类型
export type ValidationRuleSet = {
  required?: boolean;
  minLength?: number;
  maxLength?: number;
  min?: number;
  max?: number;
  pattern?: RegExp;
};

export type FieldValidationRules = Record<string, ValidationRuleSet>;

// 导出常用验证函数的类型
export type ValidatorFunction<T> = (data: T) => {
  isValid: boolean;
  errors: string[];
  warnings?: string[];
};

// 导出字段验证函数类型
export type FieldValidatorFunction = (value: unknown, fieldName: string) => {
  field: string;
  isValid: boolean;
  message?: string;
};